import {
    TabExpViewActionType,
    ITabExpViewAbility,
    ITabExpViewControllerParams,
    ITabExpViewModel,
    ITabExpViewStore,
    IParam,
    IViewEvent,
} from '@/core';
import { QXEvent } from 'qx-util';
import {
    getViewClassNames,
    useViewAction,
    useViewBasic,
    useViewControllerParams,
    useViewProps,
} from '../use-view';

/**
 * 获取分页导航视图输入参数
 *
 * @export
 * @return {*}
 */
export function useTabExpViewProps() {
    return {
        ...useViewProps()
    };
}

/**
 * 获取分页导航视图基础
 *
 * @export
 * @param {ITabExpViewModel} model 分页导航视图模型
 * @param {IParam} props 输入参数
 * @return {*}
 */
export function useTabExpViewBasic(model: ITabExpViewModel, props: IParam) {
    const getClassNames = (props: IParam) => {
        return getViewClassNames(model, props);;
    }
    return {
        ...useViewBasic(model, props),
        getClassNames,
    };
}

/**
 * 分页导航视图行为
 *
 * @export
 */
export function useTabExpViewAction(controller: any) {
    return {
        ...useViewAction(controller),
    };
}

/**
 * 获取分页导航视图控制器输入参数
 *
 * @export
 * @param {ITabExpViewModel} model
 * @param {IParam} props
 * @param {QXEvent<IViewEvent<TabExpViewActionType, ITabExpViewAbility>>} evt
 * @return {*}  {ITabExpViewControllerParams<TabExpViewActionType, ITabExpViewAbility>}
 */
export function useTabExpViewControllerParams(
    model: ITabExpViewModel,
    props: IParam,
    evt: QXEvent<IViewEvent<TabExpViewActionType, ITabExpViewAbility>>
): ITabExpViewControllerParams<TabExpViewActionType, ITabExpViewAbility> {
    return {
        ...useViewControllerParams<ITabExpViewStore, ITabExpViewModel>(
            model,
            props,
            evt
        ),
    };
}
